set(LIB_NAME detection)

find_package(OpenCV  REQUIRED)
find_package(CUDA REQUIRED)
aux_source_directory(. DIR_LIB_SRCS)
include_directories(
    ${PROJECT_SOURCE_DIR}/include
    ${Opencv_INCLUDE_DIRS}
    ${CUDA_INCLUDE_DIRS}  
    
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Ofast -Wfatal-errors")

#add wrapper
set(TRT_WRAPPER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/TensorRTWrapper/)
add_subdirectory(${TRT_WRAPPER_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include/detection/TensorRTWrapper)


#add opencv
FIND_PACKAGE(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIBRARIES_DIRS})

add_library(${LIB_NAME} SHARED ${DIR_LIB_SRCS})

set_target_properties (${LIB_NAME} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties (${LIB_NAME} PROPERTIES VERSION 1.0 SOVERSION 1)
target_link_libraries(${LIB_NAME} ${OpenCV_LIBS} TrtNet  ${CUDA_LIBRARIES})

set(CMAKE_STAGING_PREFIX /opt/adc)
install(TARGETS ${LIB_NAME}
  ARCHIVE DESTINATION ${CMAKE_STAGING_PREFIX}/lib
  LIBRARY DESTINATION ${CMAKE_STAGING_PREFIX}/lib
 # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)

